package com.shuang.controller;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.shuang.common.PageObject;
import com.shuang.pojo.DbOrder;
import com.shuang.service.DbOrderService;

@RequestMapping("/order")
@Controller
public class DbOrderHanlder {
		
	@Resource(name="dbOrderService")
	private DbOrderService dbOrderService;
	@RequestMapping("/getOrderList")
	@ResponseBody
	public PageObject<DbOrder> getOrderListByStatusAndPage(short status,@RequestParam(defaultValue="1")int page,@RequestParam(defaultValue="10")int rows){
		return dbOrderService.getOrderListByStatusAndPage(status,page,rows);
	}

	@RequestMapping("/updateOrderStatus/{oId}/{status}")
	@ResponseBody
	public Map<String ,Object>updateOrderStatus(@PathVariable short status,@PathVariable long oId){
		return dbOrderService.updateOrderStatusByOid(oId,status);
	}
}
